package com.trkj.service;


import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.trkj.dao.jpa.IJlTbstaffDAO;
import com.trkj.pojos.Tbstaff;


@Service
@Transactional
public class JlTbstaffService {
	@Autowired  
	private IJlTbstaffDAO staffDAO;
	//根据eid查找
		public List<Tbstaff> useFindNameTbstaff(long staffNo){			
			return staffDAO.useFindNameTbstaff(staffNo);
		}
		public List<Tbstaff> useygidToTbstaff(long staffNo){			
			return staffDAO.useygidToTbstaff(staffNo);
		}
		public List<Tbstaff> bmidToTbstaff(BigDecimal departmentNo){			
			return staffDAO.bmidToTbstaff(departmentNo);
		}
		public List<Tbstaff> useygnameToTbstaff(String staffName){			
			return staffDAO.useygnameToTbstaff(staffName);
		}
		public Map<String, Object> finTbstaffpageing(int page, int rows){
			PageRequest pr = new PageRequest(page - 1, rows);
			//获取当前页的记录
			List<Tbstaff> list = staffDAO.finTbstaffpageing(pr);
			//获取总的记录条数
			long total = staffDAO.count();			
			Map<String, Object> map = new HashMap<>();
			map.put("total", total);
			map.put("rows", list);
			return map;
		}
		public List<Tbstaff> finTbstaff(){			
			return  staffDAO.finTbstaff();			
		}
		public List<Tbstaff> idToTbstaff(Long staffNo){			
			return  staffDAO.idToTbstaff(staffNo);			
		}
		
}
